package com.ninghushangbao.ninghu.service.Impl;

import com.ninghushangbao.ninghu.entity.Company;
import com.ninghushangbao.ninghu.mapper.CompanyMapper;
import com.ninghushangbao.ninghu.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class CompanyServiceImpl implements CompanyService {

    @Autowired
    CompanyMapper companyMapper;

    @Override
    public void addCompany(Company company) {
        company.setCreateTime(new Date());
        company.setUpdateTime(new Date());
        companyMapper.addCompany(company);
    }

    @Override
    public List<Company> selectCompany() {
        return companyMapper.selectCompany();
    }

    @Override
    public Company selectCompanyById(int id) {
        return companyMapper.selectCompanyById(id);
    }

    @Override
    public void updateCompany(Company company) {
        company.setUpdateTime(new Date());
        companyMapper.updateCompany(company);
    }

    @Override
    public void deleteCompanyById(List<Integer> companyId) {
        companyMapper.deleteCompanyById(companyId);
    }
}
